﻿using DigitalHealth.PACS.ChatWebSocket.Repositories;
using DigitalHealth.PACS.ChatWebSocket.Repositories.Imp;
using DigitalHealth.PACS.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DigitalHealth.PACS.ChatWebSocket.Services.Imp
{

    internal class ChatUserServerImp : IChatUserServer
    {
        public IChatUserRepository chatUserRepository { get; set; }

        public ChatUserServerImp(IChatUserRepository chatUserRepository)
        {
            this.chatUserRepository = chatUserRepository;
        }

        public bool ChatUserExists(ChatUser chatUser)
        {
            return chatUserRepository.ChatUserExists(chatUser.Id.ToString());
        }

        public void Create(ChatUser chatUser)
        {
            chatUserRepository.Create(chatUser);
        }

        public void Delete(ChatUser chatUser)
        {
            chatUserRepository.Delete(chatUser);
        }

        public IEnumerable<ChatUser> GetChatUsers()
        {
            return chatUserRepository.GetChatUsers();
        }

        public IEnumerable<ChatUser> GetChatUsersByGroup(ChatGroup chatGroup)
        {
            return chatUserRepository.GetChatUserByChatGroup(chatGroup);
        }

        public ChatUser GetChatUsersById(string id)
        {
            return chatUserRepository.GetChatUserById(id);
        }

        public ChatUser GetChatUsersByNo(string no)
        {
            return chatUserRepository.GetChatUserByUserNo(no);
        }


        public void Update(ChatUser chatUser)
        {
            chatUserRepository.Update(chatUser);
        }
    }
}
